﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CDCOSDH
{
    public partial class FindRlpSeqNum : Form
    {
        private string sdhName;
        private string caseNum;

        public List<string> selectedRow = new List<string>(10);

        public FindRlpSeqNum(string sdhName, string caseNum)
        {
            this.sdhName = sdhName;
            this.caseNum = caseNum;

            InitializeComponent();
            this.rb1.Select();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            if (rb1.Checked)
            {
                using (MyActiveIncomingDocs myActiveIncomingDocs = new MyActiveIncomingDocs(this.sdhName, "pick.ind.mine"))
                {
                    if (myActiveIncomingDocs.ShowDialog(this) == DialogResult.OK)
                    {
                        this.selectedRow.AddRange(myActiveIncomingDocs.selectedRow);
                        this.DialogResult = DialogResult.OK;
                    }
                }
            }

            if (rb2.Checked)
            {
                using (ActiveIncomingDocsByOffice activeIncomingDocsByOffice = new ActiveIncomingDocsByOffice(this.sdhName, "pick.ind.kontor"))
                {
                    if (activeIncomingDocsByOffice.ShowDialog(this) == DialogResult.OK)
                    {
                        this.selectedRow.AddRange(activeIncomingDocsByOffice.selectedRow);
                        this.DialogResult = DialogResult.OK;
                    }
                }
            }

            if (rb3.Checked)
            {
                using (ActiveIncomingByCaseOfficer activeIncomingByCaseOfficer = new ActiveIncomingByCaseOfficer(this.sdhName, "pick.ind.mine"))
                {
                    if (activeIncomingByCaseOfficer.ShowDialog(this) == DialogResult.OK)
                    {
                        this.selectedRow.AddRange(activeIncomingByCaseOfficer.selectedRow);
                        this.DialogResult = DialogResult.OK;
                    }
                }
            }

            if (rb4.Checked)
            {
                using (AllIncoming allIncoming = new AllIncoming(this.sdhName, "pick.ind.alle"))
                {
                    if (allIncoming.ShowDialog(this) == DialogResult.OK)
                    {
                        this.selectedRow.AddRange(allIncoming.selectedRow);
                        this.DialogResult = DialogResult.OK;
                    }
                }
            }

            if (rb5.Checked)
            {
                using (AllActiveIncomingByCase AllActiveIncomingByCase = new AllActiveIncomingByCase(this.sdhName, "pick.ind.sag", this.caseNum))
                {
                    if (AllActiveIncomingByCase.ShowDialog(this) == DialogResult.OK)
                    {
                        this.selectedRow.AddRange(AllActiveIncomingByCase.selectedRow);
                        this.DialogResult = DialogResult.OK;
                    }
                }
            }
        }

        private void btnCnl_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }
    }
}
